<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- .pervent 事件修饰符 阻止默认跳转 -->

        <button @click.prevent='handle'>点击</button>
        <a href="http://wwww.baidu.com" @click.prevent='handle1'>百度</a>
        <!-- 阻止a标签默认行为，也就是阻止了a标签的跳转功能 -->
    </div>
    <script src="../vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {

            },
            methods: {
                handle() {
                    console.log(1);

                },
                handle1() {
                    console.log(2);

                }
            }
        })
    </script>
</body>

</html>